package com.tanhua;

import cn.hutool.core.io.FileUtil;
import com.tanhua.template.AipFaceTemplate;
import com.tanhua.template.OssTemplate;
import com.tanhua.template.SmsTemplate;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

@RunWith(SpringRunner.class)
@SpringBootTest
public class DemoTest2 {

    @Autowired
    private SmsTemplate smsTemplate;

    @Autowired
    private OssTemplate ossTemplate;

    @Autowired
    private AipFaceTemplate aipFaceTemplate;



    @Test
    public void test1() throws FileNotFoundException {
        String file = "C:\\Users\\muzimoo\\Desktop\\图片\\美图\\1553765561613.png";
        String url = ossTemplate.upload(file, new FileInputStream(file));
        System.out.println(url);
    }

    @Test
    public void test2() throws FileNotFoundException {
        File file = new File("C:\\Users\\muzimoo\\Desktop\\图片\\111.jpg");
        byte[] bytes = FileUtil.readBytes(file);
        boolean flg = aipFaceTemplate.detect(bytes);
        System.out.println("是人脸不:"+flg);
    }
}
